package top.yihoxu.yoj.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.yihoxu.yoj.common.BaseResponse;
import top.yihoxu.yoj.common.ErrorCode;
import top.yihoxu.yoj.common.ResultUtils;
import top.yihoxu.yoj.exception.BusinessException;
import top.yihoxu.yoj.model.dto.questionsubmit.QuestionSubmitAddRequest;
import top.yihoxu.yoj.model.entity.User;
import top.yihoxu.yoj.service.QuestionSubmitService;
import top.yihoxu.yoj.service.UserService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author dth
 * @Date 2024/4/28 22:54
 * @PackageName:top.yihoxu.yoj.controller
 * @ClassName: QuestionSubmitController
 * @Description: 题目提交
 * @Version 1.0
 */
//@Slf4j
//@RestController
//@RequestMapping("/question_submit")
//public class QuestionSubmitController {
//
//    @Resource
//    private QuestionSubmitService questionSubmitService;
//
//    @Resource
//    private UserService userService;
//
//    @PostMapping("/")
//    public BaseResponse<Long> doQuestionSubmit(@RequestBody QuestionSubmitAddRequest questionSubmitAddRequest, HttpServletRequest request) {
//        if (questionSubmitAddRequest == null || questionSubmitAddRequest.getQuestionId() <= 0) {
//            throw new BusinessException(ErrorCode.PARAMS_ERROR);
//        }
//        final User loginUser = userService.getLoginUser(request);
//        long result = questionSubmitService.doQuestionSubmit(questionSubmitAddRequest, loginUser);
//        return ResultUtils.success(result);
//
//    }
//
//
//    /**
//     * 分页获取列表题目列表（除了管理员外，普通用户只能看到非答案、提交代码等公开信息）
//     *
//     * @param questionSubmitQueryRequest
//     * @return
//     */
////    @PostMapping("/list/page")
////    public BaseResponse<Page<QuestionSubmit>> listQuestionSubmitByPage(@RequestBody QuestionSubmitQueryRequest questionSubmitQueryRequest) {
////        long current = questionSubmitQueryRequest.getCurrent();
////        long size = postQueryRequest.getPageSize();
////        Page<Post> postPage = postService.page(new Page<>(current, size),
////                postService.getQueryWrapper(postQueryRequest));
////        return ResultUtils.success(postPage);
////    }
//
//}
